<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <li>1</li>
    <li>1</li>
    <li>1</li>
    <li>1</li>
    <li>1</li>
    <li>1</li>
    <li>1</li>
    <li>1</li>
    <li>1</li>
    <li>1</li>
</body>
<script>
    // call apply应用

    var liList = document.querySelectorAll("li");
    console.log(liList);
    // liList.slice(0, liList.length)  //伪数组一般情况下不能使用数组的拓展方法

    //call=> 伪数组转真数组
    // var result = Array.prototype.slice.call(liList);
    // var result = Array.prototype.slice.apply(liList);
    // console.log(result);

    // 模拟封装slice
    // Array.prototype.mySlice = function (startIndex = 0, endIndex = this.length) {
    //     // this -> 调用此方法的实例化对象
    //     var list = [];
    //     for (var i = startIndex; i < endIndex; i++) {
    //         var item = this[i];
    //         list.push(item);
    //     }
    //     return list;
    // }

    // var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9];
    // var result = arr.mySlice(2, 5)
    // console.log(result);


    // 判断一个数据是否是纯对象?
    var arr = [1, 2, 3, 4];
    var obj = { a: 1, b: 2, c: 3 }
    var num = new Number(1);
    var p = new Promise(function () { })

    // console.log(typeof arr);
    // console.log(typeof obj);
    // console.log(typeof num);
    // console.log(typeof p);

    // console.log(arr instanceof Object);
    // console.log(obj instanceof Object);
    // console.log(num instanceof Object);
    // console.log(p instanceof Object);


    // console.log(arr.toString());
    // console.log(obj.toString());
    // console.log(num.toString());
    // console.log(p.toString());

    r
    // console.log(Object.prototype.toString.call(arr));
    // console.log(Object.prototype.toString.call(obj));
    // console.log(Object.prototype.toString.call(num));
    // console.log(Object.prototype.toString.call(p));

    // 判断一个数据是否是纯对象数据
    // console.log(Object.prototype.toString.call(arr) === "[object Object]");
    // console.log(Object.prototype.toString.call(obj) === "[object Object]");
    // console.log(Object.prototype.toString.call(num) === "[object Object]");
    // console.log(Object.prototype.toString.call(p) === "[object Object]");

    // apply
    var arr = [2, 8, 4, 5, 6, 9, 3, 7, 1];

    // var min = Math.min(...arr);
    var min = Math.min().apply(null, arr);// 并不改变this指向,将参数整合到数组中
    console.log(min);

    // 结果: Math.min(2, 8, 4, 5, 6, 9, 3, 7, 1)











</script>

</html>